<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>注册</title>
    <link rel="stylesheet" href="layui/css/layui.css" media="all">
    <link rel="stylesheet" href="css/admin.css" media="all">
    <link rel="stylesheet" href="css/login.css" media="all">
    <link rel="stylesheet" href="css/myLayui.css">
    
</head>
<body>
        <div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">
                <div class="layadmin-user-login-main">
                  <div class="layadmin-user-login-box layadmin-user-login-header">
                    <h2>租客注册</h2>
                    <p>本功能对已入住用户提供，注册后需等待审核</p>
                  </div>
                  <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
                    <div class="layui-form-item">
                      <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-username"></label>
                      <input type="text" name="userName" id="LAY-user-login-username" lay-verify="required" placeholder="用户名" class="layui-input">
                    </div>
                    <div class="layui-form-item">
                      <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"></label>
                      <input type="password" name="userPwd" id="LAY-user-login-password" lay-verify="required" placeholder="密码" class="layui-input">
                    </div>
                    <div class="layui-form-item" style="margin-bottom: 5px;">
                      <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-repass"></label>
                      <input type="password" name="repass" id="LAY-user-login-repass" lay-verify="required" placeholder="确认密码" class="layui-input">
                    </div>
                    <div class="layui-form-item" style="margin-bottom: 5px;">
                      <label class="layui-form-label">性别</label>
                      <div class="layui-input-block">
                        <input type="radio" name="userSex" value="男" title="男" checked="">
                        <input type="radio" name="userSex" value="女" title="女">
                      </div>
                    </div>
                    <div class="layui-form-item">
                      <label class="layadmin-user-login-icon layui-icon layui-icon-cellphone" for="LAY-user-login-cellphone"></label>
                      <input type="text" name="userTel" id="LAY-user-login-cellphone" lay-verify="phone" placeholder="手机号码" class="layui-input">
                    </div>
                    <div id="home">
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                              <select  id="houseName" lay-verify="required" name="houseName">
                                <option value="">公寓名称</option>
                                <option value="蔡塘悦舍">蔡塘悦舍</option>
                                <option value="悦舍大院">悦舍大院</option>
                                <option value="悦舍阔居">悦舍阔居</option>
                              </select>
                              <label class="layadmin-user-login-icon layui-icon layui-icon-home" for="LAY-user-login-home"></label>
                            </div>
                          </div>
                          <div class="layui-form-item" >
                              <div class="layui-input-block" id="homeName">
                                <input style="padding: 0 10px" type="text" name="userDoorNO" required  lay-verify="required" placeholder="房间号：如A102" autocomplete="off" class="layui-input">
                              </div>
                            </div>
                    </div>
                 
                    

                    <div class="layui-form-item">
                      <input type="checkbox" name="agreement" lay-skin="primary" title="同意用户协议" checked>
                    </div>
                    <div class="layui-form-item">
                      <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="demo1">注 册</button>
                    </div>
                    <div class="layui-trans layui-form-item layadmin-user-login-other">
                      <label>社交账号注册</label>
                      <a href="javascript:;"><i class="layui-icon layui-icon-login-qq"></i></a>
                      <a href="javascript:;"><i class="layui-icon layui-icon-login-wechat"></i></a>
                      <a href="javascript:;"><i class="layui-icon layui-icon-login-weibo"></i></a>
                      
                      <a href="login.jsp" class="layadmin-user-jump-change layadmin-link layui-hide-xs">用已有帐号登入</a>
                      <a href="login.jsp" class="layadmin-user-jump-change layadmin-link layui-hide-sm layui-show-xs-inline-block">登入</a>
                    </div>
                  </div>
                </div>
                
                <div class="layui-trans layadmin-user-login-footer">             
                    <p>© 2019 YueShe Life By JJA1909</p>
                    <p>
                      <span><a href="index.html" target="_blank">进入主页</a></span>
                    </p>
                  </div>
            
              </div>
            
              <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script>
              <script src="layui/layui.js"></script>  
              <script>
                    //Demo
                    layui.use('form', function(){
                    var form = layui.form;
                    
                    //监听提交
                    layui.form.on('submit(demo1)', function(data){
                    	//提交表单信息给Servlet
                    	$.ajax({
							type:"post",
							url:"rs.do?op=add",
							contentType:"application/json",
							data:JSON.stringify(data.field),
							success:function(msg){
								//提示
								layer.msg(msg == "true" ? "操作成功!"
										: "操作失败", {
									icon : 1
								}, function() {

									 //关闭层，刷新页面
									parent.layer.closeAll();

									//刷新页面
									window.location.reload(); 

								});
							}
						});
                        layer.msg(JSON.stringify(data.field));
                        return false;
                    });
                    });
                    </script>

<script>
    $(function(){
      $('.layui-select-title input').attr("placeholder","选择公寓")
    })
  </script>
                
</body>
</html>